<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>AngularJS AJAX</title>
		<style>
			body{
			  font-family: 'microsoft yahei',Arial,sans-serif;
			}
			
			h1{
			  font-weight:500;
			  font-size:24px;
			}
			
			table, th , td {
			   border: 1px solid grey;
			   border-collapse: collapse;
			   padding: 10px;
			}
			
			table tr:nth-child(odd) {
			   background-color: #E4E4E4;
			}
			
			table tr:nth-child(even) {
			   background-color: #ffffff;
			}
		</style>
	</head>

	<body>
		<h1>AngularJS AJAX演示</h1>

		<div ng-app="" ng-controller="studentController">
		<table>
		   <tr>
		      <th>姓名</th>
		      <th>编号</th>
			  <th>考分</th>
		   </tr>
		   <tr ng-repeat="student in students">
		      <td>{{ student.Name }}</td>
		      <td>{{ student.RollNo }}</td>
			  <td>{{ student.Mark }}</td>
		   </tr>
		</table>
		</div>

		<script src="http://cdn.gbtags.com/angular.js/1.2.20/angular.min.js"></script>
		<script>
			function studentController($scope,$http) {
			  //后台提供的ajax数据提供url
//			  var url="http://cdn.gbtags.com/gblibraryassets/libid102/jsondata.jsp";
			  var url="json/12angular.json";
			  
			  //使用http get方法获取数据，并且使用回调函数设置到students中
			  $http.get(url).success(function(response) {
			    $scope.students = response;
			  });
			}

		</script>
	</body>

</html>